package priv.bestbeat.reportcenter.core.monitor.mybatis;

import priv.bestbeat.reportcenter.core.monitor.ObservablePersistenceProxy;
import priv.bestbeat.reportcenter.core.monitor.TaskObservable;
import priv.bestbeat.reportcenter.core.monitor.mybatis.mapper.TaskObservableMybatisMapper;

import javax.annotation.Resource;

/**
 * @author 张渠钦
 * @date 2022/4/24 15:30
 */
public final class TaskObservableMybatisProxy extends ObservablePersistenceProxy<TaskObservable> {

    @Resource
    private TaskObservableMybatisMapper mybatisMapper;

    @Override
    public TaskObservable persist(TaskObservable obj) {
        mybatisMapper.insert(obj);
        return obj;
    }

    @Override
    public TaskObservable remove(TaskObservable obj) {
        mybatisMapper.delete(obj);
        return obj;
    }

    @Override
    public TaskObservable update(TaskObservable newer) {
        mybatisMapper.update(newer);
        return newer;
    }

    @Override
    public TaskObservable getById(TaskObservable obj) {
        return mybatisMapper.selectById(obj);
    }
}
